Reading Heartbeat Series Samples PRO
The Scripting app provides access to heartbeat series samples stored in Apple Health using the global API Health.queryHeartbeatSeriesSamples(). These samples represent beat-to-beat heartbeat intervals collected during workouts or background monitoring sessions (usually via Apple Watch).
Each record contains the time range, number of beats, and optional metadata, but not the raw interval values.
What Is a Heartbeat Series Sample?
A HealthHeartbeatSeriesSample object includes:
uuid: A unique identifier for the samplesampleType: Always"heartbeatSeries"startDate/endDate: The time range over which the heartbeats were recordedcount: The number of heartbeat intervals collectedmetadata: Optional information attached by the recording source (e.g., watch model, app version)
Note: This API provides high-level information about the series. It does not expose individual heartbeat intervals.
API Reference
Parameters
Example: Query Recent Heartbeat Series
Limitations
-
Individual heartbeat intervals (R–R data) are not accessible via this API.
-
To analyze HRV or derive BPM, you’ll need only the
countand duration: -
Gaps or anomalies (e.g. pauses, data loss) are not available in this summary sample.
Summary
To read heartbeat series:
- Call
Health.queryHeartbeatSeriesSamples()with optional date range or limits. - Iterate through the returned
HealthHeartbeatSeriesSampleobjects. - Each item provides
startDate,endDate,count, andmetadata. - You can approximate average BPM over the session using
countand duration.
This API is useful for overviewing heart rhythm tracking sessions, especially for detecting how often heart rate was sampled during a day or workout.
